#!/bin/sh
echo "打包 skynet server"

function copy() {
    echo $1
    echo $2
    for file in $1
    do
        echo $file
        filepath=`dirname $file`
        subpath=${filepath:2}
        filename=`basename $file`

        echo $filepath
        echo $subpath
        echo $filename

        if [ ! -d $2/$subpath/ ]; then
            #statements
            # echo "not exist"
            mkdir -p $2/$subpath/
        fi
        if test -f $file
        then
            # $luajit -b $file ./gamebin/$subpath/$filename
            if [ "${filename##*.}" != "so" ]; then
                cp $file $2/$subpath/$filename
            fi
        fi
    done
}

if [ ! -d ./out ]; then
    #statements
    # echo "not exist"
    mkdir -p ./out
fi

a=$1
b=$2

cur=`pwd`

cd $cur

cp -R ../skynet ./out

# rm -rf ./out/skynet/$b/log

cd ./out/
tar -czvf skynetbin_$a.tar.gz skynet

rm -rf ./out/skynet

